home *** CD-ROM | disk | FTP | other *** search
- /* ===================================================================== */
- /* file: cf.dem */
- /* the line cf(frac1+frac2) loops !!!! */
- /* the 2 last lines gives erroneous results */
- /* CONTINUED FRACTIONS. THIS IS GOOD STUFF. */
-
- FRAC1:CF([1,2,3,4]);
- FRAC2:CF([2,3,4,5]);
- CFDISREP(FRAC1);
- CF(FRAC1+FRAC2);
- CFDISREP(%);
-
-
- cf(467288576/469097433);
- cfdisrep(%);
- ratsimp(%);
-
-
- /* CF can make the continued fraction expansion of SQRT(N) to
- CFLENGTH terms. */
-
- BLOCK([CFLENGTH:4],CFDISREP(CF(SQRT(3))));
- RATSIMP(%);
- %^2-3;
-
- RATSQRT(N,CFLENGTH):=RATSIMP(CFDISREP(CF(SQRT(N))))$
-
- RATSQRT(1776,25);
- %^2-1776;
-
- /* With the primitives of SQRT and rational operations
- continued fraction expansions of many trancendental expressions
- may be made in the classical way. */
-
- /* ======================== END ==== END ====================== */
-